1. Field of the invention
The present invention relates to a data transfer method for transferring data frames between plural devices such as one-chip microcomputers (hereafter "microcomputers") using a serial data bus comprising three signal lines, specifically a data line, clock line, and control line.
2. Description of the prior art
Data transfer methods can be broadly categorized as parallel transfer methods using a parallel data bus, or serial transfer methods using a serial data bus (hereafter "serial bus"). While parallel transfer is well-suited to high speed data transfers, this method also tends to increase the number of pins required in the communicating devices, i.e., microcomputers and ICs. While serial transfer methods tend to be slower than parallel transfers, fewer pins are required and the transfer rate is still sufficient for many microcomputer applications, including the microcomputers used in audio/visual equipment and home appliances which typically use serial transfer methods. With the increasing functionality of consumer electronics, plural microcomputers are often used in single products such as video cassette recorders and camcorders.
In products such as these, the microcomputers do not operate independently, but by exchanging data over serial buses. Various other IC and LSI devices can also be connected to this serial bus in addition to the microcomputers.
A data transfer method using a three-line serial bus is described in Japanese patent laid-open number HEI 4-332065, "data transfer method." The data transfer method described in this application uses, in addition to the data line and clock line, a control line for identifying the data being transferred as a token or a data frame. The microcomputer functioning as the controller distributes a token to each microcomputer connected to the serial bus in sequence when the control line is HIGH. When a microcomputer receives the token, obtains the access rights to the serial bus, and attempts to transfer a data frame over the bus, the microcomputer sets the control line to LOW to become the master and notify the other microcomputers of its use of the serial bus. If the control line is changed to LOW, the controller stops token distribution, and outputs the clock required for data frame transmission. The master begins data frame transmission based on this clock. When data frame transfer ends, the master resets the control line to HIGH. The controller thus detects when the control line is again HIGH to begin token distribution.
This data transfer method makes it possible to prevent data collisions on the bus, does not require modulation for transfers, and makes it possible to transfer data frames of any desired pattern. The drawbacks to this data transfer method (patent laid-open number HEI 4-332065) are described below.
With this conventional data transfer method, the controller distributes a token, and only the microcomputer that has received the token has the right to send a data frame. As a result, when another microcomputer transferring data frames over the serial bus is added, the token distribution program of the controller must be written to anticipate the addition of microcomputers that can become the master, and the token distribution program of the controller must be modified when masters that cannot be anticipated are added.
With the conventional data transfer method, the slave(s) that should receive the transferred data are also specified using an address header at the beginning of the data frame, and frame transfer is terminated when the acknowledge data is returned from the slave(s). As a result, it is also necessary to change the address data when a slave-dedicated microcomputer is added to this serial bus, and data transfers are disabled if the slave microcomputer is removed without changing the address. Thus, simply stated, one problem with this conventional data transfer method is that microcomputers cannot be easily added to or removed from the serial bus.
This problem of easily adding and removing microcomputers from a three-line serial bus was addressed in Japanese patent laid-open number SHO 63-58567, "serial interface serial bus method". With this method, the HIGH control line state is confirmed, the control line is then set LOW, an ID code is sent, and data transmission occurs when the received ID matches the transmitted ID code. When data transfer is completed, the control line is then reset HIGH. Because arbitration using tokens does not occur in this method, microcomputers can be easily added to and removed from the serial bus. It is also possible, however, that plural microcomputers will simultaneously send an ID code, resulting in collisions. As a result, it is not possible to contain the time from occurrence of the data send request to the actual data transfer termination within a predetermined period. When the data transfer frequency increases, the frequency of collisions increases, and the possibility that effective data transfer cannot be sustained also increases.
In the first conventional data transfer method (patent laid-open number HEI 4-332065) above, the non-controller microcomputers (the "targets" below) must also monitor the control line with external interrupts if efficient data transfer is to occur. Specifically, when the targets check the control line level in serial receiving interrupts rather than external interrupts, level detection errors can occur if the control line level is changed by the master during the period between issuing the serial receiving interrupt and checking the level.
One possible method of avoiding such detection errors is to make the master wait a predetermined period after completing transfer of one transfer unit before operating the control line, thus enabling the microcomputers other than the master to check the control line for a predetermined period after issuing the serial receiving interrupt. Simply stated, control line level detection errors are avoided by controlling the timing of control line operations.
Because this method requires the control line to be checked during a predetermined period, however, serial receiving interrupts must be accepted even when processing other interrupts. In addition, either a hardware or software timer is needed to regulate the timing of control line operations. As a result, the targets must monitor the control line using external interrupts because methods preventing detection errors by restricting the timing of control line operations impose numerous restrictions on system design.
The other problem with this conventional data transfer method (patent laid-open number 4-332065) is that the actual data transfer efficiency is poor because various types of control data (e.g., tokens, address data, error detection codes, and acknowledge data) must also be sent as part of the transfer protocol for each single frame data transfer.